
<div class="noidung" id="here">
    <div style="padding-left: 0px; width: 100%">
        <div class="colleft">

            <?php $this->renderPartial('commercial'); ?>
        </div>
        <div class="colright" style="margin: 0px">
            <div style="margin-left: 7px; width: 100%">

                <?php
                $urlbtnxem = 'http://chomoionline.com/icon/btnxem.PNG';
                $css = "";
                $dem = null;
                if ($produc != null) {
                    $dem = $produc->pr_name;

                    if (strlen($dem) >= 60) {
                        $css = "bgtopic600";
                    } else if (strlen($dem) >= 39) {
                        $css = "bgtopic500";
                    } else {
                        $css = "bgtopic340";
                    }
                }
                ?>


                <div class="<?php echo $css; ?>">
                    <div class="topic_title">
                        <?php
                        if ($produc != null) {
                            echo $produc->pr_name;
                        }
                        ?>
                    </div>
                </div>

                <p>
                <div style="width: 630px; padding-right: 10px; padding-bottom: 10px; ">
                    <?php if ($produc != null) {
                        ?>
                        <div style="float: left; margin-right: 20px">

                            <div class="fb-like" data-href="<?php echo 'http://chomoionline.com/noi-dung/' . $produc->prid . '/' . $produc->asia_name . '/'; ?>" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
                        </div>
                        <div style="float: left; margin-right: 20px">
                            <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
                            <g:plusone size="medium"></g:plusone>

                        </div>
                        <div >
                            <a href="https://twitter.com/share" class="twitter-share-button" data-lang="vn" data-url="<?php echo 'http://chomoionline.com/noi-dung/' . $produc->prid . '/' . $produc->asia_name . '/'; ?>">Tweet</a>
                            <script>!function(d, s, id) {
                                    var js, fjs = d.getElementsByTagName(s)[0];
                                    if (!d.getElementById(id)) {
                                        js = d.createElement(s);
                                        js.id = id;
                                        js.src = "https://platform.twitter.com/widgets.js";
                                        fjs.parentNode.insertBefore(js, fjs);
                                    }
                                }(document, "script", "twitter-wjs");</script>
                        </div>
                    <?php }
                    ?>

                    <?php
                    if ($produc != null) {
                        echo $produc->pr_content;
                    } else {
                        echo '<div style="color:red;font-weight: bold;font-size: 15pt;">Nội dung không tồn tại!</div>';
                    }
                    ?>
                </div>
                </p>
                <div style="width: 100%;height: 50px"></div>
                <div class="<?php echo $css; ?>">
                    <div class="topic_title">
                        <?php
                        if ($category != null) {
                            if ($category->catename === 'Khác') {
                                $cate = Category::model()->findAllByPk($category->parent);
                                if (!empty($cate)) {
                                    foreach ($cate as $item) {
                                        echo $item->catename . ' khác';
                                    }
                                }
                            } else {
                                echo $category->catename . ' khác';
                            }
                        }
                        ?>
                    </div>
                </div>
                <p>
                    <?php
                    if (!empty($items)) {
                        foreach ($items as $item) {
                            ?>
                        <div class="boxsp">
                            <div class="sale">
                                <div class="txtdiscount">
                                    <?php
                                    if ($pr->discount > 1000) {
                                        echo '<div style="padding-top: 5px;font-size: 16px;">Quà</div>';
                                    } elseif ($pr->discount > 999) {
                                        echo '<div style="padding-top: 5px;font-size: 16px;">Mới</div>';
                                    } else {
                                        echo $pr->discount . '<span>%</span>';
                                    }
                                    ?>

                                </div>
                            </div>
                            <div class="boxspImg">
                                <?php
                                $getUrl = $item->pr_url;
                                if ($getUrl === "") {
                                    $getUrl = $this->createUrl('/site/thong_tin', array('id' => $item->prid));
                                }
                                ?>
                                <a href="<?php echo $getUrl; ?>" title="<?php echo $item->pr_name; ?>">
                                    <img src="<?php echo Yii::app()->request->baseUrl . '/upload/product/avata/' . $item->avatar ?>" width="190" height="205">
                                </a>
                            </div>
                            <div class="boxspTitle">
                                <a href="<?php echo $getUrl; ?>" title="<?php echo $item->pr_name; ?>">
                                    <?php echo $item->pr_name; ?>
                                </a>
                            </div>
                            <div class="boxspPrice">
                                <div class="txttimer">
                                    <div class="product-date-<?php echo $item->prid; ?>"></div>

                                    <script>
                                        jQuery(document).ready(function() {

                                            jQuery(".product-date-<?php echo $item->prid; ?>").countdown({
        <?php
        if (($pr->pr_enddate) == '') {
            $date = "1/1/2013 0:0:0";
        } else {
            $dd =date('Y-m-d',strtotime($pr->pr_enddate));
            if($dd==date('Y-m-d')){
               
                $date = date('Y-m-d', strtotime($dd. ' + 2 day'));
               
            }elseif ($dd==date('Y-m-d', strtotime(date('Y-m-d'). ' + 1 day'))) {
                 $date = date('Y-m-d', strtotime($dd. ' + 1 day'));
            }
            else {
                $date = $pr->pr_enddate;
            }
            
        }
        ?>

                                                date: "<?php echo $date; ?>",
                                                render: function(data) {
                                                    jQuery(this.el).html("Còn " + this.leadingZeros(data.days, 2) + " <span> ngày </span>");
                                                }
                                            });

                                        });

                                    </script>
                                </div>
                                <div class="btnXem">
                                    <a href="<?php echo $getUrl; ?>" title="<?php echo $item->pr_name; ?>"><img src="<?php echo $urlbtnxem; ?>"></a>
                                </div>
                            </div>
                        </div>
                        <?php
                    }
                }
                ?>

                </p>
            </div>
        </div>
    </div>

    <div style="clear: both; padding-bottom: 10px"></div>
</div>

